﻿using OR.Interface;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OR
{
    public class Modelo : IModelo, INotifyPropertyChanged
    {
        private bool ativo;
        private DateTime datacadastro;
        private DateTime dataalteracao;

        public Boolean Ativo 
        { 
            get 
            { 
                return this.ativo; 
            }
            set 
            { 
                this.ativo = value;
                this.OnPropertyChanged("Ativo");
            } 
        }
        public DateTime DataCadastro 
        { 
            get 
            { 
                return this.datacadastro; 
            } 
            set 
            { 
                this.datacadastro = value;
                this.OnPropertyChanged("DataCadastro");
            } 
        }
        public DateTime DataAlteracao
        { 
            get 
            { 
                return this.dataalteracao; 
            } 
            set
            { 
                this.dataalteracao = value;
                this.OnPropertyChanged("DataAlteracao");
            } 
        }

        public Modelo()
        {
            DataAlteracao = DateTime.MinValue;
            DataCadastro = DateTime.Now.Date;
            Ativo = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
       
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
